package com.zmn.mcc.permit.client.policy.impl;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.mcc.permit.client.model.InterceptDecisionBO;
import com.zmn.mcc.permit.client.policy.interfaces.NoPermissionPolicy;

import java.lang.reflect.Field;
import java.util.Collections;

/**
 * 无权限时不处理属性，直接返回成功且数据为空集的ResponseDTO
 *
 * @author hankangshuai
 * @since 2020/06/18
 */
public class ReturnResponseDTOSuccessPolicyImpl implements NoPermissionPolicy {

    @Override
    public InterceptDecisionBO processNoPermission(Object noPermissionParamObj, Field noPermissionField, Object[] targetAllParams) {
        return InterceptDecisionBO.doIntercept(ResponseDTO.success(Collections.emptyList(), "no permission"));
    }

}
